import java.io.InputStream;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import com.xsprite.managesys.bean.User;

public class Test {
	public static void main(String[] args) {
        String resource = "conf.xml";
        InputStream is = Test.class.getClassLoader().getResourceAsStream(resource);
        SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(is);
        SqlSession session = sessionFactory.openSession();
        String statement = "me.gacl.mapping.userMapper.getUser";//映射sql的标识字符串
        //执行查询返回一个唯一user对象的sql
        User user = new User();
        user.setUsername("张彰");
        user.setUserpass("123");
        User u = (User) session.selectOne(statement, user);
        System.out.println(u);
		
//		String resource = "mybatis-config.xml";
	}
}
